Image re-encoding method and device thereof

ABSTRACT

Provided is a method of determining whether an image is to be re-encoded, the method including obtaining a first quantization matrix from an image file including the image, the image being encoded by quantization based on the first quantization matrix including a plurality of first quantization parameters; obtaining a second quantization matrix from a re-encoding device, the second quantization matrix including a plurality of second quantization parameters and having the same size as the first quantization matrix; determining a comparison coefficient based on elements greater than ‘0’ among elements of a comparison matrix obtained by subtracting the first quantization matrix from the second quantization matrix; and determining that the image is to be decoded by inverse quantization based on the first quantization matrix and the decoded image is to be re-encoded by quantization based on the second quantization matrix, when the comparison coefficient is greater than a first threshold value.

TECHNICAL FIELD

The present invention relates to a method of re-encoding an image toincrease compression efficiency with respect to the image.

BACKGROUND ART

As hardware for reproducing and storing high-resolution or high-qualityvideo content is being developed and supplied, a need for a compressionscheme for effectively encoding or decoding the high-resolution orhigh-quality video content is increasing.

In particular, since the amount of information contained in a digitalvideo signal is very large, it is essential to compress video data so asto efficiently store, detect, and transmit the information.

Thus, many video-data compression techniques have been developed. AJoint Photographic Experts Group (JPEG) format which is an internationalstandard still-image compression format has been introduced in relationto video compression techniques.

However, a compression rate of the JPEG format is no higher than that ofan image compression format that is widely compatible or other latestimage compression formats. Thus, an image encoded in the JPEG formatneeds to be re-encoded in a format with a high compression rate.

DETAILED DESCRIPTION OF THE INVENTION Technical Problem

Provided are a device and method for determining whether an image is tobe re-encoded, in which whether an image filed is to be re-encoded isdetermined using a comparison between quantization matrices, accordingto an embodiment. Provided are also a program for implementing in acomputer a method of determining whether an image is to be re-encoded,and a computer-readable recording medium having recorded thereon theprogram, according to an embodiment. Technical objectives to beaccomplished in the embodiments are not, however, limited thereto andother technical objectives may be derived from the followingembodiments.

Technical Solution

According to an embodiment, a method of determining whether an image isto be re-encoded includes obtaining a first quantization matrix from animage file including the image encoded by quantization based on thefirst quantization matrix including a plurality of first quantizationparameters; obtaining a second quantization matrix from a re-encodingdevice, the second quantization matrix including a plurality of secondquantization parameters and having the same size as the firstquantization matrix; determining a comparison coefficient based onelements greater than ‘0’ among elements of a comparison matrix obtainedby subtracting the first quantization matrix from the secondquantization matrix; and determining that the image is to be decoded byinverse quantization based on the first quantization matrix and thedecoded image is to be re-encoded by quantization based on the secondquantization matrix, when the comparison coefficient is greater than afirst threshold value.

The determining of the comparison coefficient may include determining anumber of the elements greater than ‘0’ among the elements of thecomparison matrix to be the comparison coefficient.

The determining that the image is to be decoded and the decoded image isto be re-encoded may include determining that the image is to be decodedand the decoded image is to be re-encoded when the comparisoncoefficient is greater than the first threshold value determined basedon a size of the comparison matrix.

The determining of the comparison coefficient may include determining avalue obtained by adding weights allocated to locations of the elementsgreater than ‘0’ among the elements of the comparison matrix to be thecomparison coefficient.

The determining that the image is to be decoded and the decoded image isto be re-encoded may include determining that the image is to be decodedand the decoded image is to be re-encoded when the comparisoncoefficient is greater than the first threshold value determined basedon a size of the comparison matrix and on weights allocated to locationsof the elements of the comparison matrix.

The method may further include determining that the image is not to bere-encoded when the image file includes an identifier indicating thatthe image has been encoded by quantization based on the secondquantization matrix. The obtaining of the first quantization matrix mayinclude obtaining the first quantization matrix when the image file doesnot include the identifier.

The method may further include determining a representative value of theplurality of first quantization parameters of the first quantizationmatrix; and determining that the image is not to be re-encoded when therepresentative value is greater than a second threshold value. Theobtaining of the second quantization matrix may include obtaining thesecond quantization matrix when the representative value is less thanthe second threshold value.

According to an embodiment, a device for determining whether an image isto be re-encoded includes a first quantization matrix obtainerconfigured to obtain a first quantization matrix from an image fileincluding the image encoded by quantization based on the firstquantization matrix including a plurality of first quantizationparameters; a second quantization matrix obtainer configured to obtain asecond quantization matrix from a re-encoding device, the secondquantization matrix including a plurality of second quantizationparameters and having the same size as the first quantization matrix;and a re-encoding determiner configured to determine a comparisoncoefficient based on elements greater than ‘0’ among elements of acomparison matrix obtained by subtracting the first quantization matrixfrom the second quantization matrix, and determine that the image is tobe decoded by inverse quantization based on the first quantizationmatrix and the decoded image is to be re-encoded by quantization basedon the second quantization matrix when the comparison coefficient isgreater than a first threshold value.

The re-encoding determiner may be further configured to determine anumber of the elements greater than ‘0’ among the elements of thecomparison matrix to be the comparison coefficient.

The re-encoding determiner may be further configured to determine thatthe image is to be decoded and the decoded image is to be re-encodedwhen the comparison coefficient is greater than the first thresholdvalue determined based on a size of the comparison matrix.

The re-encoding determiner may be further configured to determine avalue obtained by adding weights allocated to locations of the elementsgreater than ‘0’ among the elements of the comparison matrix to be thecomparison coefficient.

The re-encoding determiner may be further configured to determine thatthe image is to be decoded and the decoded image is to be re-encodedwhen the comparison coefficient is greater than the first thresholdvalue determined based on a size of the comparison matrix and on weightsallocated to locations of the elements of the comparison matrix.

The re-encoding determiner may be further configured to determine thatthe image is not to be re-encoded when the image file includes anidentifier indicating that the image has been encoded by quantizationbased on the second quantization matrix. The first quantization matrixobtainer may be further configured to obtain the first quantizationmatrix when the image file does not include the identifier.

The re-encoding determiner may be further configured to determine arepresentative value of the plurality of first quantization parametersof the first quantization matrix, and to determine that the image is notto be re-encoded when the representative value is greater than a secondthreshold value. The second quantization matrix obtainer may be furtherconfigured to obtain the second quantization matrix when therepresentative value is less than the second threshold value.

A computer-readable recording medium having recorded thereon a programfor implementing re-encoding determination methods according to variousembodiments is suggested.

A program for implementing re-encoding determination methods accordingto various embodiments is suggested.

Advantageous Effect

Whether an image is to be re-encoded is determined using a method ofdetermining whether an image is to be re-encoded. Thus, when images arere-encoded, an image having high re-compression efficiency may beselectively compressed. Accordingly, when a large amount of images arecompressed, some images may be selectively compressed to prevent imageswhich do not needed to be re-compressed from being re-compressed. Thus,computing resources of a computing system may be prevented from beingwasted.

DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of an image re-encoding determination device100 for determining whether an image is to be re-encoded, according toan embodiment.

FIG. 2 is a flowchart of a re-encoding method 200 according to anembodiment.

FIGS. 3A to 3C illustrate quantization matrices 310 and 320 and acomparison matrix 330 for explaining a re-encoding determination methodof FIG. 5, according to an embodiment.

FIG. 4 is a flowchart of a re-encoding determination method 400according to an embodiment.

FIG. 5 illustrates a weight matrix 500 for explaining a re-encodingdetermination method, performed by a re-encoding determiner, accordingto an embodiment.

FIG. 6 is a flowchart of a re-encoding method 600 according to anotherembodiment.

FIG. 7 is a flowchart of a re-encoding method 700 according to anotherembodiment.

FIG. 8 illustrates a first quantization matrix 800 for explaining are-encoding determination method, performed by a re-encoding determiner,according to an embodiment.

FIG. 9 is a flowchart of a re-encoding determination method 900according to another embodiment.

FIG. 10 is a flowchart of a re-encoding determination method 1000according to another embodiment.

FIG. 11 is a flowchart of an encoded image file management method 1100according to an embodiment.

FIG. 12 is a block diagram of an image re-encoding device 1200 forre-encoding an image file by determining whether an image is to bere-encoded, according to an embodiment.

FIG. 13 is a block diagram of an image re-encoding device forre-encoding an image, according to an embodiment.

BEST MODE

According to an embodiment, a method of determining whether an image isto be re-encoded includes obtaining a first quantization matrix from animage file including the image encoded by quantization based on thefirst quantization matrix including a plurality of first quantizationparameters; obtaining a second quantization matrix from a re-encodingdevice, the second quantization matrix including a plurality of secondquantization parameters and having the same size as the firstquantization matrix; determining a comparison coefficient based onelements greater than ‘0’ among elements of a comparison matrix obtainedby subtracting the first quantization matrix from the secondquantization matrix; and determining that the image is to be decoded byinverse quantization based on the first quantization matrix and thedecoded image is to be re-encoded by quantization based on the secondquantization matrix, when the comparison coefficient is greater than afirst threshold value.

According to an embodiment, a device for determining whether an image isto be re-encoded includes a first quantization matrix obtainerconfigured to obtain a first quantization matrix from an image fileincluding the image encoded by quantization based on the firstquantization matrix including a plurality of first quantizationparameters; a second quantization matrix obtainer configured to obtain asecond quantization matrix from a re-encoding device, the secondquantization matrix including a plurality of second quantizationparameters and having the same size as the first quantization matrix;and a re-encoding determiner configured to determine a comparisoncoefficient based on elements greater than ‘0’ among elements of acomparison matrix obtained by subtracting the first quantization matrixfrom the second quantization matrix, and determine that the image is tobe decoded by inverse quantization based on the first quantizationmatrix and the decoded image is to be re-encoded by quantization basedon the second quantization matrix when the comparison coefficient isgreater than a first threshold value.

MODE OF THE INVENTION

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the presentdisclosure. As used herein, the singular forms ‘a’, ‘an’ and ‘the’ areintended to include the plural forms as well, unless the context clearlyindicates otherwise. It will be further understood that the terms‘comprise’ and/or ‘comprising,’ when used in this specification, specifythe presence of stated elements, operations, etc., but do not precludethe presence or addition of one or more other elements, operations, etc.

Hereinafter, the term ‘image’ should be understood as a still image.When an image to be decoded is an input image, an image reconstructed bydecoding an input bitstream is a reconstructed image, and an imagere-encoded by a re-encoding device is an output image, the term ‘image’should be understood to include all the input image, the reconstructedimage, and the output image. For example, the input image or the outputimage may be an image compressed in the JPEG format.

Hereinafter, the term ‘image file’ should be understood as a fileincluding an encoded image and information related to the encoded image.The encoded image may be an image encoded in the JPEG format. Theinformation related to the encoded image may include coding informationsuch as a quantization matrix used in an image encoding process.

Methods of determining whether an image is to be re-encoded according toembodiments will be described with reference to FIGS. 1 to 10 below.Furthermore, a method of managing encoded image files by re-encodingimages will be described with reference to FIGS. 1 to 13 below.

FIG. 1 is a block diagram of an image re-encoding determination device100 for determining whether an image is to be re-encoded, according toan embodiment.

The image re-encoding determination device 100 may include a firstquantization matrix obtainer 110, a second quantization matrix obtainer120, and a re-encoding determiner 130.

The first quantization matrix obtainer 110 obtains a first quantizationmatrix from an image file including an image encoded by quantizationbased on a first quantization matrix including a plurality of firstquantization parameters. The first quantization matrix obtainer 110 mayobtain the first quantization matrix from a header of an encoded imagefile.

The second quantization matrix obtainer 120 may obtain a secondquantization matrix including a plurality of second quantizationparameters and having the same size as the first quantization matrix.The second quantization matrix obtainer 120 may obtain the secondquantization matrix by transforming the first quantization matrix.

For example, a case in which a first element and a second elementincluded in the first quantization matrix respectively correspond to athird element and a fourth element included in the second quantizationmatrix will be described below.

The second quantization matrix obtainer 120 according to an embodimentmay set values of the third element and the fourth element with respectto the first element and the second element which are randomly selected,such that the difference between a value obtained by dividing a value ofthe first element by a value of the second element and a value obtainedby dividing the value of the third element by the value of the fourthelement is in a predetermined range. For example, when ‘10’ and ‘5’which are elements of the first quantization matrix correspond to ‘x’and ‘y’ which are elements of the second quantization matrix, values of‘x’ and ‘y’ may be set to satisfy a condition that ‘x/y’ is greater thanor equal to ‘1’ and equal to or less than ‘3’.

When the first element included in the first quantization matrixcorresponds to the third element included in the second quantizationmatrix, the second quantization matrix obtainer 120 according to anembodiment may set the value of the third element to a value obtained bymultiplying the value of the first element by a value which is in thepredetermined range. For example, if the predetermined range is greaterthan or equal to ‘10’ and equal to or less than ‘15’, an integer among‘10’ to ‘15’ may be selected as the third element when the value of thefirst element is ‘1’. As another example, if the predetermined range isgreater than or equal to ‘3’ and equal to or less than ‘4’, the value ofthe third element may be ‘6’ and the value of the fourth element may be‘12’ when the value of the first element is ‘2’ and the value of thesecond element is ‘3’. As another example, if the predetermined range isgreater than or equal to ‘4’ and equal to or less than ‘6’, the value ofthe third element may be ‘18’ and the value of the fourth element may be‘16’ when the value of the first element is ‘3’ and the value of thesecond element is ‘4’.

Various methods may be used to determine a value to be multiplied to anelement included in the first quantization matrix so as to determine anelement included in the second quantization matrix. For example, a valueto be selected from a predetermined range may be selected according to apredetermined rule, may be selected randomly, may be determined to be aspecific value, may be determined according to the location of each ofthe elements of the first quantization matrix, or may be determinedaccording to each of the elements of the first quantization matrix.

The second quantization matrix obtainer 120 according to an embodimentmay produce the second quantization matrix based on a luminance value ofa region quantized using the first quantization matrix.

For example, the second quantization matrix obtainer 120 may obtain anaverage luminance value of the region quantized using the firstquantization matrix, and produce the second quantization matrix based onthe average luminance value.

For example, an average element value which is an average of the valuesof the elements included in the second quantization matrix may bedetermined on the basis of an average luminance value which is anaverage of luminance values of samples included in an image or one ofblocks of the image. The second quantization matrix obtainer 120 may setvalues of elements to be included in the second quantization matrix suchthat an average element value when the average luminance value is lessthan a specific value is less than an average element value when theaverage luminance value is greater than the specific value.

If an average of values of elements to be included in the secondquantization matrix is determined to be proportional to the averageluminance value, a degree of degradation of image quality when an imagehaving a low average luminance value is re-encoded may be lower thanthat when an image having a high average luminance value is re-encoded.

A method of setting values of elements of a quantization matrix to beproportional to a luminance value may be appropriate to re-encode animage, the image quality of which is less degraded when a screen is darkthan when the screen is light.

As another example, the second quantization matrix obtainer 120 may setvalues of elements to be included in the second quantization matrix suchthat an average element value when an average luminance value is lessthan a specific value is greater than that when the average luminancevalue is greater than the specific value.

When an average of values of elements to be included in the secondquantization matrix is determined to be inversely proportional to anaverage luminance value, a degree of degradation of image quality whenan image having a low average luminance value is re-encoded may behigher than that when an image having a high average luminance value isre-encoded.

A method of setting an average of values of elements of a quantizationmatrix to be inversely proportional to a luminance value may beappropriate to re-encode an image, the image quality of which is lessdegraded when a screen is dark than when the screen is light.

As another example, when a fifth element which is a random elementincluded in the first quantization matrix corresponds to a sixth elementincluded in the second quantization matrix, the sixth element may have avalue obtained by multiplying a value to a value of the fifth elementand adding a value to a result of the multiplication. For example, thesecond quantization matrix may include elements having values obtainedby multiplying ‘5’ to values of all the elements of the firstquantization matrix and adding ‘7’ to results of the multiplication.

The sizes of the first quantization matrix and the second quantizationmatrix may be determined beforehand. For example, the first quantizationmatrix and the second quantization matrix may be determined beforehandto have a size of 8×8.

The method of obtaining the second quantization matrix, performed by thesecond quantization matrix obtainer 120, described above is merely anexample and thus the second quantization matrix obtainer 120 may obtainthe second quantization matrix according to a different method.

The re-encoding determiner 130 may compare the first quantization matrixand the second quantization matrix with each other and determine whetheran encoded image file is to be re-encoded according to a result of thecomparison.

The re-encoding determiner 130 may determine a comparison coefficient onthe basis of elements greater than ‘0’ among elements of a comparisonmatrix obtained by subtracting the first quantization matrix from thesecond quantization matrix. When the comparison coefficient is greaterthan a first threshold value, the re-encoding determiner 130 maydetermine that an image is to be decoded by inverse quantization basedon the first quantization matrix and the decoded image is to bere-encoded by quantization based on the second quantization matrix.

In one embodiment, the re-encoding determiner 130 may determine thenumber of the elements greater than ‘0’ among the elements included inthe comparison matrix to be a comparison coefficient. Then there-encoding determiner 130 may determine the first threshold value onthe basis of a size of the comparison matrix. For example, when thenumber of elements greater than ‘0’ among elements of an 8×8 comparisonmatrix is ‘50’, ‘50’ is determined to be a comparison coefficient. Whenthe first threshold value is determined to be a value corresponding to75% of the number of the elements of the comparison matrix, the firstthreshold value may be determined to be ‘48’ which is 75% of ‘64’ whichis the number of the elements of the 8×8 comparison matrix. In thiscase, the comparison coefficient ‘50’ is greater than the firstthreshold value ‘48’ and thus the re-encoding determiner 130 maydetermine that the encoded image file is to be re-encoded, as will bedescribed in more detail with reference to FIGS. 5 and 6 below.

In one embodiment, the re-encoding determiner 130 may determine a valueobtained by adding weights allocated to locations of elements greaterthan ‘0’ among the elements of the comparison matrix to be thecomparison coefficient. Furthermore, the re-encoding determiner 130 maydetermine the first threshold value on the basis of the size of thecomparison matrix and the weights allocated to locations of the elementsof the comparison matrix, as will be described in more detail withreference to FIGS. 7 and 8 below.

In one embodiment, the re-encoding determiner 130 may determine not tore-encode an image when an encoded image file includes an identifierindicating that the image has been encoded by quantization based on thesecond quantization matrix. In this case, the first quantization matrixobtainer 110 does not obtain the first quantization matrix. In contrast,when the encoded image file does not include the identifier, the firstquantization matrix obtainer 110 may obtain the first quantizationmatrix, as will be described in more detail with reference to FIG. 9below.

In one embodiment, the re-encoding determiner 130 may determine arepresentative value of first quantization parameters of the firstquantization matrix, and determine not to re-encode the image when therepresentative value is greater than a second threshold value. In thiscase, the second quantization matrix obtainer 120 does not obtain thesecond quantization matrix, as will be described in more detail withreference to FIGS. 10 and 11 below.

FIG. 2 is a flowchart of a re-encoding method according to anembodiment. In detail, FIG. 2 is a flowchart of a re-encoding method, inwhich the number of elements greater than or less than ‘0’ amongelements of a comparison matrix is determined to be a comparisoncoefficient.

In one embodiment, a first quantization matrix and a second quantizationmatrix are compared with each other to determine whether re-encoding isto be performed. The first quantization matrix includes a firstquantization parameter. Similarly, the second quantization matrixincludes a second quantization parameter. The first quantizationparameter at a point (i,j) on the first quantization matrix is comparedwith the second quantization parameter at a point (i,j) on the secondquantization matrix.

A comparison matrix may be produced by subtracting the firstquantization matrix from the second quantization matrix so that thefirst quantization matrix and the second quantization matrix may beeasily compared with each other. Thereafter, the first quantizationmatrix and the second quantization matrix may be compared with eachother on the basis of values of elements of the comparison matrix.

The number of elements greater than or equal to ‘0’ among the elementsof the comparison matrix may be determined to be a comparisoncoefficient. When the determined comparison coefficient is greater thana first threshold value, an image file is determined to be re-encoded.

The first threshold value may be determined on the basis of the numberof elements of the first quantization matrix. For example, the firstthreshold value may be set to a value corresponding to 75% of the numberof the elements of the first quantization matrix.

In FIG. 2, i represents an order of the elements of the comparisonmatrix. Count represents the number of elements greater than ‘0’ amongcorresponding elements included in the comparison matrix. Q representsthe comparison matrix. Qi represents the i^(th) element of thecomparison matrix. total number represents the total number of theelements of the comparison matrix. TH represents the first thresholdvalue.

In operation S210, Count is set to ‘0’ and i is set to ‘1’.

In operation S220, it is determined whether Qi is greater than or equalto ‘0’. When Qi is greater than or equal to ‘0’, operation S230 isperformed. When Qi is less than ‘0’, operation S240 is performed.

In operation S230, Count is increased by ‘1’. Then operation S240 isperformed.

In operation S240, it is determined whether i is equal to total number.When i is not equal to total number, operation S250 is performed. When iis equal to total number, operation S260 is performed.

In operation S250, i is increased by ‘1’. Then operation S220 isperformed.

Operations S220 to S250 are repeatedly performed to determine whetherall the elements of the comparison matrix are greater than or equal to‘0’.

In operation S260, it is determined whether Count is greater than TH.When Count is greater than or equal to TH, operation S270 is performed.When Count is less than TH, it is determined that re-encoding is not tobe performed.

In operation S270, the image file is re-encoded.

FIGS. 3A to 3C illustrate quantization matrices and a comparison matrixfor explaining a re-encoding determination method to be described withreference to FIG. 5 below, according to an embodiment.

A first quantization matrix 310 illustrated in FIG. 3A includes firstquantization parameters. A second quantization matrix 320 illustrated inFIG. 3B includes second quantization parameters. A comparison matrix 330illustrated in FIG. 3C is a matrix obtained by subtracting the firstquantization matrix 310 from the second quantization matrix 320. Thus,elements of the comparison matrix 330 are the same as values obtained bysubtracting the first quantization parameters corresponding to thesecond quantization parameters from the second quantization parameters.

In the comparison matrix 330, the number of elements greater than orequal to ‘0’ is ‘49’. Thus, a comparison coefficient is determined to be‘49’. When a first threshold value is ‘50’, the comparison coefficientis less than the first threshold value and thus an image file isdetermined to be not re-encoded. When the first threshold value is ‘40’,the comparison coefficient is greater than the first threshold value andthus the image file is determined to be re-encoded.

8×8 quantization matrices and an 8×8 comparison matrix are described asan example with reference to FIG. 3. However, the re-encodingdetermination method to be described with reference to FIG. 3 below isapplicable to quantization matrices and a comparison matrix havingdifferent sizes.

The quantization parameters used in FIG. 3 are randomly selected forconvenience of explanation and thus different values may be selected.

FIG. 4 is a flowchart of a re-encoding determination method according toan embodiment. In detail, FIG. 4 illustrates a method of determiningwhether re-encoding is to be performed using a comparison coefficientdetermined in consideration of weights according to locations ofelements a comparison matrix.

Transformation coefficients to be quantized vary according to afrequency region. In general, transformation coefficients correspondingto a DC or low-frequency region are large and transformationcoefficients corresponding to a low-frequency region are relativelysmall. Thus, as quantization parameters for the transformationcoefficients corresponding to the DC or low-frequency region areincreased, compression effect according to re-encoding increases. Thus,higher weights may be allocated to the transformation coefficientscorresponding to the DC or low-frequency region than those allocated toother transformation coefficients.

A change in a signal corresponding to a DC or low-frequency region isrecognizable to human eyes but a change in a signal corresponding to ahigh-frequency region is difficult to recognize with human eyes. Thus,in a quantization process, quantization parameters corresponding totransformation coefficients of a high-frequency region are set to largevalues, thereby increasing compression efficiency. Thus, in are-encoding process, when quantization parameters corresponding totransformation coefficients of a high-frequency region are increased,compression efficiency may be relatively increased by decreasing adegree of degradation of image quality. Accordingly, high weights may beallocated to the quantization parameters corresponding to thetransformation coefficients of the high-frequency region.

Thus, when a first quantization matrix and a second quantization matrixare compared with each other, high weights may be allocated to thequantization parameters corresponding to the transformation coefficientsof the DC or low-frequency region and the quantization parameterscorresponding to the transformation coefficients of the high-frequencyregion.

In one embodiment, a weight matrix includes weights corresponding toquantization parameters. Weights allocated to quantization parameters onlocations corresponding to elements of the weight matrix are given tothe elements of the weight matrix. For example, a weight allocated to aquantization parameter at a point (1,1) on the quantization matrix isgiven to an element at a point (1,1) on the weight matrix.

The quantization parameters corresponding to the transformationcoefficients of the DC or low-frequency region are located on an upperleft portion of the quantization matrix. The quantization parameterscorresponding to the transformation coefficients of the high-frequencyregion are located on a lower right portion of the quantization matrix.Thus, elements on the upper left portion and the lower right portion ofthe weight matrix are large.

The comparison coefficient is determined by elements greater than orequal to ‘0’ among elements of the comparison matrix and the elements ofthe weight matrix. In detail, the comparison coefficient is determinedby calculating locations of the elements greater than or equal to ‘0’among the elements of the comparison matrix and adding elements of theweight matrix corresponding to the locations of the elements.

For example, the comparison coefficient may be determined to be ‘24’when elements at points (1,1), (1,3), and (2,2) among the elements ofthe comparison matrix are greater than or equal to ‘0’ and elements atpoints (1,1), (1,3), and (2,2) on the weight matrix are ‘10’, ‘7’, and‘7’.

When the comparison coefficient is greater than a first threshold value,an image file is determined to be re-encoded.

The first threshold value may be determined based on the elements of theweight matrix. For example, the first threshold value may be determinedto be 75% of a value obtained by adding the elements of the weightmatrix together.

In FIG. 4, i represents an order of the elements of the comparisonmatrix. Count represents the sum of elements of the weight matrixcorresponding to elements greater than or equal to ‘0’ amongcorresponding elements of the comparison matrix. Q represents thecomparison matrix. Qi represents the i^(th) element of the comparisonmatrix. R represents the weight matrix. Ri represents the i^(th) elementof the weight matrix. FIG. 5 illustrates an example of a weight matrix.total number represents the total number of the elements of thecomparison matrix. TH represents the first threshold value.

In operation S410, Count is set to ‘0’ and i is set to ‘1’.

In operation S420, it is determined whether Qi is greater than or equalto ‘0’. When Qi is greater than or equal to ‘0’, operation S430 isperformed. When Qi is less than ‘0’, operation S440 is performed.

In operation S430, Count is increased by Ri. Then operation S440 isperformed.

In operation S440, it is determined whether i is the same as totalnumber. When i is not the same as total number, operation S450 isperformed. When i is the same as total number, operation S460 isperformed.

In operation S450, i is increased by ‘1’. Then operation S420 isperformed.

Operations S420 to S450 are repeatedly performed to determine whetherall the elements of the comparison matrix are greater than or equal to‘0’.

In operation S460, it is determined whether Count is greater than TH.When Count is greater than or equal to TH, operation S470 is performed.When Count is less than TH, the image file is determined to be notre-encoded.

In operation S470, the image file is re-encoded.

FIG. 5 illustrates a weight matrix 500 for explaining a re-encodingdetermination method, performed by a re-encoding determiner, accordingto an embodiment.

The weight matrix 500 includes weights corresponding to the elements ofthe comparison matrix 330 of FIG. 3C. Thus, the weight matrix 500 hasthe same size as the comparison matrix 330.

The elements on an upper left portion and a lower right portion of theweight matrix 500 are greater than the other elements thereof. Forexample, an element at a point (1,1) on an 8×8 weight matrix has a sizeof 10 and an element at a point (8,8) on the 8×8 weight matrix has asize of 5. In contrast, an element at a point (5,5) on the 8×8 weightmatrix has a size of 1 and is thus relatively small.

A comparison coefficient may be calculated by adding weights of theweight matrix 500 corresponding to the elements of the comparison matrix330 which are greater than or equal to ‘0’. The comparison coefficientdetermined using the comparison matrix 330 and the weight matrix 500 is‘142’. When a first threshold value is determined to be ‘140’, an imagefile is determined to be re-encoded. When the first threshold value isdetermined to be ‘150’, the image file is determined to be notre-encoded.

In FIG. 5, an 8×8 weight matrix is described as an example. However, there-encoding determination method of FIG. 4 is also applicable to aweight matrix having a different size.

The weights of the weight matrix of FIG. 5 are randomly selected forconvenience of explanation and thus different values may be selected.

FIG. 6 is a flowchart of a re-encoding method 600 according to anotherembodiment.

When an encoded image file has been re-encoded by the same re-encoder,the encoded image file need not be re-encoded by the re-encoder. Thus,before a first quantization matrix is obtained from the encoded imagefile, the encoded image file may be automatically determined to be notre-encoded when an identifier indicating that the encoded image file hasbeen re-encoded is included in a header of the encoded image file.

Various methods may be used to allocate weights and calculate acomparison coefficient according to a weight matrix and quantizationparameters used to compare the first quantization matrix and a secondquantization matrix with each other, in addition to the method describedabove.

In operation S610, it is determined whether an identifier indicatingthat an image has been encoded by quantization based on the secondquantization matrix is included in the image file. When the identifieris included, the re-encoding method 600 is ended without re-encoding theimage file. When the identifier is not included, operation S620 isperformed.

In operation S620, it is determined whether the image file is to bere-encoded. In operation S620, whether the image file is to bere-encoded may be determined according to the methods described withreference to FIGS. 5 to 8 above. When it is determined that the imagefile is not to be re-encoded, the re-encoding method 600 is ended. Whenit is determined that the image file is to be re-encoded, operation S630is performed.

In operation S630, the image file is re-encoded.

FIG. 7 is a flowchart of a re-encoding method 700 according to anotherembodiment.

If first quantization parameters of a first quantization matrix are verylarge, a compression rate of an encoded image is very high. Accordingly,no compression effect is obtained or the quality of the image may belowered and the image is thus damaged to a great extent when the encodedimage is re-encoded. Thus, a representative value of the firstquantization parameters is compared with a second threshold value, andthe encoded image file may be determined to be not re-encoded when therepresentative value is greater than the second threshold value, beforethe first quantization parameters are compared with second quantizationparameters.

In FIG. 7, T represents the representative value of the firstquantization matrix. The representative value T may be determined by thefirst quantization parameters of the first quantization matrix. Forexample, the representative value T may be an average value of the firstquantization parameters.

TH3 represents the second threshold value. The second threshold valueTH3 is set to be very high so that an image file compressed at a highcompression rate may be filtered.

In operation S710, the representative value T of the first quantizationmatrix is calculated.

In operation S720, it is determined whether the representative value Tis less than the second threshold value TH3. If the representative valueT is less than the second threshold value TH3, operation S730 isperformed. In contrast, when the representative value T is greater thanor equal to the second threshold value TH3, a re-encoding determinationmethod is ended.

In operation S730, the first quantization parameters and secondquantization parameters are compared with one another to determinewhether the encoded image file is to be re-encoded. If the encoded imagefile is determined to be re-encoded, operation S740 is performed. Incontrast, when the encoded image file is determined to be notre-encoded, the re-encoding determination method is ended.

In operation S740, the encoded image file is re-encoded.

FIG. 8 illustrates a first quantization matrix 800 for explaining are-encoding determination method, performed by a re-encoding determiner,according to an embodiment.

First quantization parameters of the first quantization matrix 800 ofFIG. 8 are generally large values. Thus, when an image has been encodedusing the first quantization matrix 800, a compression rate of the imagefile may be enough high to be not re-encoded.

When a representative value T of the first quantization parameters is anaverage value of the first quantization parameters, the representativevalue T of the first quantization parameters of the first quantizationmatrix 800 is ‘123’. When a second threshold value TH3 is ‘100’, therepresentative value T is greater than the second threshold value TH3and thus the image file encoded using the first quantization matrix 800is determined to be not re-encoded.

FIG. 9 is a flowchart of a re-encoding determination method 900,performed by a re-encoding determination device, according to anotherembodiment.

In operation S910, a first quantization matrix including a plurality offirst quantization parameters is obtained from an image file includingan image encoded by quantization based on the first quantization matrix.

In operation S920, a second quantization matrix including a plurality ofsecond quantization parameters and having the same size as the firstquantization matrix is obtained from a re-encoding device.

In operation S930, a comparison coefficient is determined on the basisof elements greater than ‘0’ among elements of a comparison matrixobtained by subtracting the first quantization matrix from the secondquantization matrix.

For example, the number of the elements greater than ‘0’ among theelements of the comparison matrix may be determined to be the comparisoncoefficient. In this case, a first threshold value may be determined onthe basis of a size of the comparison matrix.

As another example, the first threshold value may be determined to be avalue obtained by adding weights allocated to locations of the elementsgreater than ‘0’ among the elements of the comparison matrix. In thiscase, the first threshold value is determined on the basis of the sizeof the comparison matrix and the weights allocated to the locations ofthe elements of the comparison matrix.

In operation S940, it is determined that the image is to be decoded byinverse quantization based on the first quantization matrix and thedecoded image is to be re-encoded by quantization based on the secondquantization matrix, when the comparison coefficient is greater than thefirst threshold value.

FIG. 10 is a flowchart of a re-encoding determination method 1000,performed by a re-encoding determination device, according to anotherembodiment.

In operation S1010, it is determined whether an image file includes anidentifier indicating that an image has been encoded by quantizationbased on a second quantization matrix. When the identifier is includedin the image file, the image is determined to be not re-encoded. Whenthe identifier is not included in the image file, operation S1020 isperformed.

In operation S1020, a first quantization matrix is obtained from animage file including an image encoded by quantization based on the firstquantization matrix including a plurality of first quantizationparameters.

In operation S1030, a representative value of the first quantizationparameters of the first quantization matrix obtained in operation S1020is determined, and it is determined whether the representative value isgreater than a second threshold value. When the representative value isgreater than the second threshold value, the image is determined to benot re-encoded. In contrast, when the representative value is less thansecond threshold value, operation S1040 is performed.

In operation S1040, the second quantization matrix including a pluralityof second quantization parameters and having the same size as the firstquantization matrix is obtained by a re-encoding device.

In operation S1050, a comparison coefficient is determined on the basisof elements greater than ‘0’ among elements of a comparison matrixobtained by subtracting the first quantization matrix from the secondquantization matrix.

In operation S1060, when the comparison coefficient is greater than afirst threshold value, it is determined that the image is to be decodedby inverse quantization based on the first quantization matrix and thedecoded image is to be re-encoded by quantization based on the secondquantization matrix.

FIG. 11 is a flowchart of an encoded image file management method 1100according to an embodiment. In detail, FIG. 11 illustrates a flowchartof an encoded image file management method, in which when there is anencoded image file, an image is decoded and the decoded image file isre-encoded according to an encoding method having a higher compressionrate to greatly reduce the amount of the image file.

In operation S1110, it is determined whether an image file managementfunction is to be implemented. The image file management function is afunction of determining an image file to be re-encoded from amongencoded image files and re-encoding the determined image file to managethe amount of encoded images recorded on a recording medium. Whether theimage file management function is to be implemented may be manuallydetermined according to user input. Alternatively, when a specificcondition is satisfied, whether the image file management function is tobe implemented may be automatically determined.

For example, the image file management function may be automaticallyimplemented at a specific time set by a user. In detail, when the usersets the image file management function to be implemented only at thespecific time, a re-encoding device may perform re-encoding at thepredetermined time and automatically end re-encoding at other times. There-encoding device may statistically analyze a user's activity scheduleand determine a specific time at which the image file managementfunction is to be implemented. As another example, the image filemanagement function may be automatically implemented in an airplanemode.

As another example, the image file management function may be set toperform re-encoding only when a device which implements the image filemanagement function is in a charged state. As another example, the imagefile management function may be set to perform re-encoding only when aremaining battery capacity of a device which implements the image filemanagement function is greater than or equal to a predetermined level.Thus, battery power may be prevented from being excessively consumed dueto implementation of the image file management function.

As another example, the image file management function may beimplemented when a remaining storage capacity of a device having theimage file management function exceeds a reference level. As a concreteexample, the image file management function may be set to be implementedwhen a total size of image files exceeds 20% of the storage capacity ofa device.

As another example, the image file management function may be set to beautomatically implemented when the image file management function hasnot been implemented for a long time period. As a concrete example, ifthe image file management function is set to be implemented once perweek, the image file management function is implemented seven days aftera day on which it was implemented lately.

As another example, the image file management function may beimplemented when a central processing unit (CPU) and a memory of adevice having the image file management function are used at a certainlevel or less. As a concrete example, if the image file managementfunction is set to be implemented when the CPU and the memory of thedevice are used at 20% or less, the image file management function maybe implemented when the number of applications which are being executedin the device is small and thus the CPU and the memory are used at 10%.In a similar embodiment, since temperature of a device having the imagefile management function increases according to the amount ofcalculation of a CPU of the device, the image file management functionmay be set to be implemented when the temperature of the device is low.

As another example, the image file management function may beautomatically implemented in the airplane mode. In the airplane mode,execution of a large number of applications is restricted and executionof the image file management function is thus not a burden on thecalculation of the CPU and the memory.

As another example, the image file management function may beautomatically implemented while a function of a device having the imagefile management function other than an image file function is performed.As a concrete example, the image file management function may beimplemented during execution of a navigation application (whiledriving), a fitness application (while exercising), or an e-bookapplication (while reading).

As another example, the image file management function may be set to benot performed when throttling is performed on a CPU of a device havingthe image file management function. Throttling means an operation ofdecreasing the calculation performance of the CPU to reduce generationof heat due to the CPU when the CPU is overloaded and is thus heated toa certain temperature. Thus, when throttling is performed, the imagefile management function may be discontinued to decrease burden on theCPU.

As another example, the image file management function may beimplemented when a device having the image file management function isnot operated for a predetermined time period and a screen thereof isturned off. As a concrete example, if the image file management functionis set to be implemented when the device is not operated for tenminutes, the image file management function is implemented when a userdoes not operate the device for ten minutes.

In operation S1120, an image which will be a re-encoding determinationtarget is determined. In detail, an image satisfying a specificcondition among a plurality of images stored in a storage device isdetermined to be a re-encoding determination target. The condition isset such that an image file, the image quality of which is not loweredto a great extent even when the image file is re-encoded is generallydetermined to be a target to be re-encoded.

For example, an image file having a bit size per pixel which is greaterthan or equal to specific bits may be determined to be a re-encodingdetermination target on the basis of a size of the image file or EXIFinformation contained in the image file. As a concrete example, when animage file having a bit size per pixel which is greater than or equal to32 bits is set to be a re-encoding determination target, an image filehaving a bit size per pixel which is 16 bits is not determined to be are-encoding determination target and an image file having a bit size perpixel which is 32 bits is determined to be a re-encoding determinationtarget.

As another example, an image file having a resolution higher than apredetermined resolution may be determined to be a re-encodingdetermination target. As a concrete example, when an image file having aresolution higher than 1024×768 is set to be determined to be are-encoding determination target, an image file having a resolution of640×480 is not determined to be a re-encoding determination target andan image file having a resolution of 1024×768 is determined to bere-encoding determination target.

As a concrete example, when a ratio between a resolution of an imagefile and a resolution of a display is greater than or equal to aspecific ratio, the image file may be determined as a re-encodingdetermination target. As a concrete example, when the display has aresolution of 1024×768 and an image file having a resolution higher thanthat of the display is determined to be a re-encoding determinationtarget, an image file having a resolution of 1280×960 is a re-encodingdetermination target and an image file having a resolution of 640×480 isnot a re-encoding determination target.

As another example, an image file stored in a specific folder designatedby a user may be determined as a re-encoding determination target. As aconcrete example, if the user determines image files stored atC:\Squeezing to be re-encoding determination targets, when the usercopies an image file to C:\Squeezing, the image file copied toC:\Squeezing becomes automatically a re-encoding determination target.

As another example, an image file which will be a re-encodingdetermination target may be determined according to an image capturingdevice used to capture the image file on the basis of EXIF informationof the image file. As a concrete example, when a specific imagecapturing device has high performance and thus an image file captured bythis device has a high resolution and a large bit size per pixel, a usermay determine the image file captured by the specific image capturingdevice to be a re-encoding determination target. Thus, the image filecaptured by the specific image capturing device is automaticallydetermined as a re-encoding determination target.

As another example, when an image file is captured using EXIFinformation thereof, an image which will be a re-encoding determinationtarget may be determined according to a shooting option of an imagecapturing device. As a concrete example, whether an image file will be are-encoding determination target may be determined by extractinginformation regarding factors, such as an exposure time and an aperturevalue, which determine the image quality of an image file from the EXIFinformation of the image file.

As another example, an image file backed up in an external device may bedetermined to be a re-encoding determination target. When the image fileis backed up in the external device, the image file may be reconstructedusing a backup copy of the image file even if the image quality of theimage file is lowered when the image file is re-encoded. Thus the imagefile backed up in the external device is determined to be a re-encodingdetermination target.

As another example, whether an image file is to be re-encoded may bedetermined according to a creation date thereof. In particular, an imagefile created a long time ago may be determined as a re-encodingdetermination target. As a concrete example, when an image file created100 days ago or more is set to be determined to be a re-encodingdetermination target, an image file becomes automatically a re-encodingdetermination target on a 100th day since the image file was created.

As another example, whether an image file is to be re-encoded may bedetermined according to a viewing rate. In particular, an image filewith a low viewing rate may be determined to be a re-encodingdetermination target. As a concrete example, when an image file with aviewing rate of less than 50 times is set to a re-encoding determinationtarget, an image file with a viewing rate of 100 times is not are-encoding determination target and an image file with a viewing rateof 20 times is a re-encoding determination target.

As another example, an original image file of an image file modifiedusing an image editing program or application may be determined to be are-encoding determination target. When an original image file ismodified using the image editing program or application, a user islikely to use a modified image file rather than the original image fileand thus the original image file is determined to be a re-encodingdetermination target.

As another example, an image file downloaded from a server may bedetermined to be a re-encoding determination target. Since an originalimage file of the image file is stored in the server, the image file maybe reconstructed using the original image file when the image quality ofthe image file is lowered as the image file is re-encoded. Thus, theimage file downloaded from the server is a re-encoding determinationtarget. Furthermore, even when an image file stored in another device isreceived, the image file may be easily reconstructed using an originalimage file thereof and thus the image file may be a re-encodingdetermination target.

As another example, a plurality of image files captured in a continuousshooting mode of an image capturing device may be re-encodingdetermination targets. As a concrete example, when a user selects one ofa plurality of image files, the other image files except the selectedimage file may be re-encoding determination targets.

The conditions listed above may be applied solely in an embodiment. Theconditions listed above may be applied in combination in anotherembodiment.

A condition of determining a re-encoding determination target is not,however, limited to the conditions listed above. Thus, an image filewhich will be a re-encoding determination target may be determinedaccording to a condition other than the conditions listed above.

In operation S1130, it is determined whether the image file determinedas the re-encoding determination target in operation S1120 is to bere-encoded.

In operation S1140, the image file determined to be re-encoded inoperation S1130 is re-encoded. A re-encoding method will be described indetail with reference to FIG. 13 below.

FIG. 12 is a block diagram of an image re-encoding device 1200 forre-encoding an image file by determining whether an image is to bere-encoded, according to an embodiment.

The image re-encoding device 1200 performs operations S1130 and S1140 ofFIG. 11. The image re-encoding device 1200 may include a firstquantization matrix obtainer 1210, a second quantization matrix obtainer1220, a re-encoding determiner 1230, a decoder 1240, and a re-encoder1250.

An encoded image file 1205 is an encoded image file determined to bere-encoded in operation S1120 of FIG. 11. A first quantization matrix1215 may be included in a header of the encoded image file 1205.

The first quantization matrix obtainer 1210 obtains the firstquantization matrix 1215 from the encoded image file 1205. The firstquantization matrix obtainer 1210 may obtain the first quantizationmatrix 1215 stored in the header of the encoded image file 1205.

The first quantization matrix 1215 is a matrix including firstquantization parameters used in a quantization process included in aprocess of encoding the encoded image file 1205. The first quantizationmatrix 1215 may be used in a decoding process of reconstructing theencoded image file 1205 to obtain a reconstructed image file 1245.

The second quantization matrix obtainer 1220 obtains a secondquantization matrix 1225 by transforming the first quantization matrix1215 obtained by the first quantization matrix obtainer 1210. Variousmethods may be used to obtain the second quantization matrix 1225.

The second quantization matrix 1225 is obtained by transforming thefirst quantization matrix 215 by the second quantization matrix obtainer1220. The second quantization matrix 1225 may be used in a quantizationprocess included in a process of re-encoding the reconstructed imagefile 1245.

The re-encoding determiner 1230 compares the first quantization matrix1215 and the second quantization matrix 1225 with each other, anddetermines whether the encoded image file 1205 is to be re-encodedaccording to a result of the comparison. Methods of comparing the firstquantization matrix 1215 and the second quantization matrix 1225 witheach other according to embodiments are as described above withreference to FIGS. 1 to 10.

When the re-encoding determiner 1230 determines that the encoded imagefile 1205 is to be re-encoded, the encoded image file 1205 and the firstquantization matrix 1215 are transmitted to the decoder 1240. When there-encoding determiner 1230 determines that the encoded image file 1205is not to be re-encoded, the encoded image file 1205 is output as anoutput of the image re-encoding device 1200.

The decoder 1240 obtains the reconstructed image file 1245 by decodingthe encoded image file 1205. The decoder 1240 may use coding informationsuch as the first quantization matrix 1215 used in an encoding processof obtaining the encoded image file 1205.

The reconstructed image file 1245 is an image file obtained by decodingthe encoded image file 1205.

The re-encoder 1250 obtains a re-encoded image file 1255 by re-encodingthe reconstructed image file 1245. The re-encoder 1250 may use thesecond quantization matrix 1225 in a quantization process included in are-encoding process.

The re-encoded image file 1255 is obtained by re-encoding thereconstructed image file 1245. The re-encoded image file 1255 has ahigher compression rate than that of the encoded image file 1205. There-encoded image file 1255 is obtained by the re-encoder 1250 and isthen output as an output of the image re-encoding device 1200.

The operations of the decoder 1240 and the re-encoder 1250 will bedescribed in more detail with reference to FIG. 13 below.

FIG. 13 is a block diagram of an image re-encoding device forre-encoding an image, according to an embodiment.

A decoder 1300 of FIG. 13 is one embodiment of the decoder 1240 of FIG.12. Similarly, a re-encoder 1350 of FIG. 13 is one embodiment of there-encoder 1250 of FIG. 12.

The decoder 1300 may include an entropy decoder 1310, an inversequantizer 1320, and an inverse transformer 1330.

The entropy decoder 1310 parses an encoded image file 1305 to obtain anencoded image to be decoded and coding information needed to decode theencoded image. The entropy decoder 1310 may entropy decode a header ofthe encoded image file 1305 to obtain a first quantization matrix forinversely quantizing the encoded image. Furthermore, the entropy decoder1310 may entropy decode the encoded image of the encoded image file 1305to obtain quantized transformation coefficients generated in units ofblocks.

The inverse quantizer 1320 reconstructs transformation coefficients byinversely quantizing the quantized transformation coefficients generatedin units of blocks by using first quantization parameters included inthe first quantization matrix.

The inverse transformer 1330 inversely transforms the transformationcoefficients reconstructed by the inverse quantizer 1320 to obtain areconstructed image 1340. The inverse transformer 1330 may inverselytransform the transformation coefficients by performing inverse discretecosine transformation.

A reconstructed image file obtained by the decoder 1300 is input to there-encoder 1350.

The re-encoder 1350 may include a transformer 1360, a quantizer 1370,and an entropy encoder 1380.

The transformer 1360 may transform the reconstructed image 1340 in unitsof blocks to obtain transformation coefficients and output thetransformation coefficients. For example, the transformer 1360 mayperform discrete cosine transformation on the reconstructed image 1340in units of 8×8 pixel blocks, and output transformation coefficients.

The quantizer 1370 may quantize the transformation coefficients outputfrom the transformer 1360 by using a second quantization matrix andoutput the quantized transformation coefficients to the entropy encoder1380.

The entropy encoder 1380 may entropy encode the quantized transformationcoefficients to produce a re-encoded image file 1395. When entropyencoding is performed, a small number of bits may be allocated to asymbol with high frequency of occurrence and a large number of bits maybe allocated to a symbol with low frequency of occurrence. Thus, in thiscase, a bitstream including bit strings representing symbols may beshorter than that when bit strings are randomly allocated to symbols.Accordingly, the compression performance of video coding may beincreased by entropy coding. For entropy coding, the entropy encoder1380 according to an embodiment may use a variable length coding (VLC)method.

The above embodiments of the present invention can be embodied as acomputer program. The computer program may be stored in a non-transitorycomputer-readable recording medium, and executed using a general digitalcomputer. Examples of the non-transitory computer-readable recordingmedium include a magnetic recording medium (e.g., a ROM, a floppy disc,a hard disc, etc.), and an optical recording medium (a CD-ROM, a DVD,etc.).

1. A method of determining whether an image is to be re-encoded, themethod comprising: obtaining a first quantization matrix from an imagefile including the image, the image being encoded by quantization basedon the first quantization matrix including a plurality of firstquantization parameters; obtaining a second quantization matrix from are-encoding device, the second quantization matrix including a pluralityof second quantization parameters and having the same size as the firstquantization matrix; determining a comparison coefficient based onelements greater than ‘0’ among elements of a comparison matrix obtainedby subtracting the first quantization matrix from the secondquantization matrix; and determining that the image is to be decoded byinverse quantization based on the first quantization matrix and thedecoded image is to be re-encoded by quantization based on the secondquantization matrix, when the comparison coefficient is greater than afirst threshold value.
 2. The method of claim 1, wherein the determiningof the comparison coefficient comprises determining a number of theelements greater than ‘0’ among the elements of the comparison matrix tobe the comparison coefficient.
 3. The method of claim 2, wherein thedetermining that the image is to be decoded and the decoded image is tobe re-encoded comprises determining that the image is to be decoded andthe decoded image is to be re-encoded when the comparison coefficient isgreater than the first threshold value determined based on a size of thecomparison matrix.
 4. The method of claim 1, wherein the determining ofthe comparison coefficient comprises determining a value obtained byadding weights allocated to locations of the elements greater than ‘0’among the elements of the comparison matrix to be the comparisoncoefficient.
 5. The method of claim 4, wherein the determining that theimage is to be decoded and the decoded image is to be re-encodedcomprises determining that the image is to be decoded and the decodedimage is to be re-encoded when the comparison coefficient is greaterthan the first threshold value determined based on a size of thecomparison matrix and on weights allocated to locations of the elementsof the comparison matrix.
 6. The method of claim 1, when the image fileincludes an identifier indicating that the image has been encoded byquantization based on the second quantization matrix, further comprisingdetermining that the image is not to be re-encoded, and wherein theobtaining of the first quantization matrix comprises obtaining the firstquantization matrix when the image file does not include the identifier.7. The method of claim 1, further comprising: determining arepresentative value of the plurality of first quantization parametersof the first quantization matrix; and determining that the image is notto be re-encoded when the representative value is greater than a secondthreshold value, wherein the obtaining of the second quantization matrixcomprises obtaining the second quantization matrix when therepresentative value is less than the second threshold value.
 8. Adevice for determining whether an image is to be re-encoded, the devicecomprising: a first quantization matrix obtainer configured to obtain afirst quantization matrix from an image file including the image, theimage being encoded by quantization based on the first quantizationmatrix including a plurality of first quantization parameters; a secondquantization matrix obtainer configured to obtain a second quantizationmatrix from a re-encoding device, the second quantization matrixincluding a plurality of second quantization parameters and having thesame size as the first quantization matrix; and a re-encoding determinerconfigured to determine a comparison coefficient based on elementsgreater than ‘0’ among elements of a comparison matrix obtained bysubtracting the first quantization matrix from the second quantizationmatrix, and determine that the image is to be decoded by inversequantization based on the first quantization matrix and the decodedimage is to be re-encoded by quantization based on the secondquantization matrix when the comparison coefficient is greater than afirst threshold value.
 9. The device of claim 8, wherein the re-encodingdeterminer is further configured to determine a number of the elementsgreater than ‘0’ among the elements of the comparison matrix to be thecomparison coefficient.
 10. The device of claim 9, wherein there-encoding determiner is further configured to determine that the imageis to be decoded and the decoded image is to be re-encoded when thecomparison coefficient is greater than the first threshold valuedetermined based on a size of the comparison matrix.
 11. The device ofclaim 8, wherein the re-encoding determiner is further configured todetermine a value obtained by adding weights allocated to locations ofthe elements greater than ‘0’ among the elements of the comparisonmatrix to be the comparison coefficient.
 12. The device of claim 11,wherein the re-encoding determiner is further configured to determinethat the image is to be decoded and the decoded image is to bere-encoded when the comparison coefficient is greater than the firstthreshold value determined based on a size of the comparison matrix andon weights allocated to locations of the elements of the comparisonmatrix.
 13. The device of claim 8, wherein the re-encoding determiner isfurther configured to determine that the image is not to be re-encodedwhen the image file includes an identifier indicating that the image hasbeen encoded by quantization based on the second quantization matrix,and the first quantization matrix obtainer is further configured toobtain the first quantization matrix when the image file does notinclude the identifier.
 14. The device of claim 8, wherein there-encoding determiner is further configured to determine arepresentative value of the plurality of first quantization parametersof the first quantization matrix, and to determine that the image is notto be re-encoded when the representative value is greater than a secondthreshold value, and the second quantization matrix obtainer is furtherconfigured to obtain the second quantization matrix when therepresentative value is less than the second threshold value
 15. Anon-transitory computer-readable recording medium having recordedthereon a program for performing the method of claim 1.